package com.yexiong.server.dao.impl;

import java.util.List;

import com.common.entity.Payment;
import com.yexiong.dao.IPaymentDao;
import com.yexiong.dao.impl.PaymentDaoImpl;
import com.yexiong.server.dao.IPaymentServer;

import utils.Page;

public class PaymentServerImpl implements IPaymentServer{
	private IPaymentDao iPaymentDao=new PaymentDaoImpl();
	@Override
	public Page<Payment> getPage(String condition, int currentPage, int pageSize,String startTime,String endTime,String documenNumber,String documenType,String admin) {
		int count=iPaymentDao.getCount(startTime,endTime,condition);
		List<Payment> list=iPaymentDao.getOnePageInfo(condition, currentPage, pageSize,startTime,endTime,documenNumber,documenType,admin);
		return new Page<>(currentPage, count, pageSize, list);
	}
	@Override
	public int insert(Payment payment) {
		int result=0;
		result=iPaymentDao.insert(payment);
		return result;
	}
	@Override
	public int delete(String id) {
		int result=0;
		int documentId=Integer.parseInt(id);
		result=iPaymentDao.deleteByDocumentId(documentId);
		return result;
	}

}
